﻿using System;
using System.Collections.Generic;

namespace ToDictionary
{
    public static class ConvertStringToDic
    {
        public static Dictionary<string, string> ToDictionary(this string eingabe)
        {
            var dictionary = new Dictionary<string, string>();
            string[] sArray = eingabe.Split(new []{';'}, StringSplitOptions.RemoveEmptyEntries);

            foreach (string sKomplett in sArray)
            {
                string sKey = sKomplett.Substring(0, sKomplett.IndexOf('='));
                string sValue = sKomplett.Substring(sKomplett.IndexOf('=') + 1);
                dictionary.Add(sKey, sValue);
            }
            return dictionary; 
        }
    }
}


